<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class AddPendudukIdToLokasisTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::table('lokasis', function(Blueprint $table)
		{			
			$table->integer('penduduk_id')->unsigned()->index();
			$table->foreign('penduduk_id')->references('id')->on('penduduks')->onDelete('cascade');
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::table('lokasis', function(Blueprint $table)
		{
			$table->drop_column('penduduk_id');			
		});
	}

}
